<html>
<script src="./js/plugins/vue/dist/vue.global.js"></script>
<script src="./js/plugins/axios/dist/axios.js"></script>
<script src="js/jquery.js"></script>
<body>
<img src="//m.360buyimg.com/babel/jfs/t1/228892/14/5703/50767/6569b5b9F4b0ae004/ff0f4ed1034cfb25.jpg">
  <script>
      let url = "https://e.jd.com/";
      axios({
          method: 'get',
          url: 'https://e.jd.com/'
      }).then(res=>{
          // console.log(res.data);
         // let list = $(res.data).find(".pd_title");
         // console.log(list);
         // for (let i = 0;i<list.length;i++){
         //   let book =  list[i];
         //     console.log(book.innerHTML);
         //     console.log(book.nextSibling.childNodes[0].innerText);
         // }
          let bookList = [];
          let aElems = $(res.data).find("a[jsonparams]");
          // console.log(aElems);
          for(let i = 0;i<aElems.length;i++){
              let ll = aElems[i];
              // console.log($(ll.innerHTML).find(".pd_title"));
              let book = $(ll.innerHTML);
              let bookName = book.find(".pd_title")[0].innerHTML;
              let bookPrice = book.find(".pd_now_price")[0].innerHTML;
              bookPrice = bookPrice.substring(bookPrice.lastIndexOf('>')+1,bookPrice.length);
              let mainPic = book.find("img").attr("data-src");
              console.log(bookName,bookPrice,mainPic);
              bookList.push({
                  name: bookName,
                  saleprice: bookPrice,
                  mainPic: mainPic
              })
          }
          console.log('-----------------------')
          axios({
              method: 'post',
              url: 'http://localhost:8080/product/batch',
              data: bookList
          }).then(res=>{
              console.log(res.data.msg);
          })
      })
  </script>
</body>
</html>